home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / ld100.zip / LDDEMO.PRG < prev    next >
Text File  |  1994-04-06  |  4KB  |  171 lines

  1. *---------------------------------------------------------------------------
  2. *
  3. * Demo for Light & Dark, copyright (c) 1993,1994 DataEnter, Michael Kocum
  4. *
  5. *---------------------------------------------------------------------------
  6. #include "LD.CH"
  7. #include "INKEY.CH"
  8. *---------------------------------------------------------------------------
  9. FUNCTION MAIN()
  10. memvar getlist
  11. LOCAL nTyp,nPrinter,aCode,cText,ni,cPreBar,nWidth
  12. *
  13. SET SCOREBOARD OFF
  14. *
  15. SETCOLOR(COLORSET(3))
  16. @ 0,0 SAY PADR(" Light & Dark                 Copyright (c) 1993,1994  DataEnter, Michael Kocum",80)
  17. @ 24,0 SAY PADR(" " + LDVersion(),80)
  18. SETCOLOR(COLORSET(2))
  19. @ 1,0,23,79 BOX  "░░░░░░░░░"
  20. SETCOLOR(COLORSET(1))
  21. *
  22. SIMPLEBOX(.T.,3,5,12,43)
  23. DO WHILE .T.
  24.    @  5, 7 SAY " Select printer:"
  25.    @  5,24 PROMPT " Epson  9pin     "
  26.    @  6,24 PROMPT " Epson 24pin     "
  27.    @  7,24 PROMPT " IBM Graphic     "
  28.    @  8,24 PROMPT " HP Laserjet     "
  29.    @  9,24 PROMPT " HP Deskjet      "
  30.    @ 10,24 PROMPT " HP Deskjet Plus "
  31.    MENU TO nPrinter
  32.    *
  33.    IF LASTKEY() == K_ESC
  34.       exit
  35.    ENDIF
  36.    SIMPLEBOX(.T.,7,10,15,44)
  37.    DO WHILE .T.
  38.       @  9,12 SAY " Select Barcode:"
  39.       @  9,29 PROMPT " EAN 8       "
  40.       @ 10,29 PROMPT " EAN 13      "
  41.       @ 11,29 PROMPT " UPC 12      "
  42.       @ 12,29 PROMPT " 3/9         "
  43.       @ 13,29 PROMPT " 2/5 Int     "
  44.       MENU TO nTyp
  45.       IF LASTKEY() == K_ESC
  46.          exit
  47.       ENDIF
  48.       *
  49.       * now generate PreCode
  50.       *
  51.       DO CASE
  52.       CASE nTyp == 1          && EAN 8
  53.  
  54.          cPreBar := LDEAN8("50123452")
  55.          cText   := "EAN 8"
  56.          nWidth  := 15
  57.  
  58.       CASE nTyp == 2          && EAN 13
  59.  
  60.          cPreBar := LDEAN13("4974365610098")
  61.          cText   := "EAN 13"
  62.          nWidth  := 20
  63.  
  64.       CASE nTyp == 3          && UPC 12
  65.  
  66.          cPreBar := LDUPC12("123456789012")
  67.          cText   := "UPC 12"
  68.          nWidth  := 20
  69.  
  70.       CASE nTyp == 4          && 3/9
  71.  
  72.          cPreBar := LD39("MICHAEL")
  73.          cText   := "3/9"
  74.          nWidth  := 22
  75.  
  76.       CASE nTyp == 5          && 2/5 Int
  77.  
  78.          cPreBar := LD25Int("12345")
  79.          cText   := "2/5 Int"
  80.          nWidth  := 15
  81.  
  82.       ENDCASE
  83.       *
  84.       * Generate code array for specific printer
  85.       *
  86.       DO CASE
  87.       CASE nPrinter == 1   && Epson 9pin
  88.  
  89.          aCode := LDGenerate(LD_TYP_EPSON9,cPreBar,nWidth,3)
  90.  
  91.       CASE nPrinter == 1   && Epson 24pin
  92.  
  93.          aCode := LDGenerate(LD_TYP_EPSON24,cPreBar,nWidth,3)
  94.  
  95.       CASE nPrinter == 3   && IBM Graphic
  96.  
  97.          aCode := LDGenerate(LD_TYP_IBM9,cPreBar,nWidth,3)
  98.  
  99.       CASE nPrinter == 4   && Laserjet
  100.  
  101.          aCode := LDGenerate(LD_TYP_PCL4,cPreBar,nWidth,3)
  102.  
  103.       CASE nPrinter == 5   && Deskjet
  104.  
  105.          aCode := LDGenerate(LD_TYP_PCL3,cPreBar,nWidth,3)
  106.  
  107.       CASE nPrinter == 6   && Deskjet Plus
  108.  
  109.          aCode := LDGenerate(LD_TYP_PCL3ENH,cPreBar,nWidth,3)
  110.  
  111.       ENDCASE
  112.       *
  113.       * Now print result
  114.       *
  115.       @ 24,0 SAY PADR("Printing to LPT1...",80)
  116.       *
  117.       SET CONSOLE OFF
  118.       SET PRINTER TO LPT1
  119.       SET PRINTER ON
  120.       *
  121.       ?
  122.       ? LDVersion()
  123.       ?
  124.       ? "Sample printout of "  + cText
  125.       ?
  126.       ?
  127.       ?
  128.       ?
  129.       for ni := 1 to len(aCode)
  130.          ?? aCode[ni]
  131.       next
  132.       *
  133.       ?
  134.       *
  135.       EJECT
  136.       SET PRINTER OFF
  137.       SET CONSOLE ON
  138.       SET PRINTER TO
  139.       *
  140.       @ 24,0 SAY PADR(" " + LDVersion(),80)
  141.       *
  142.    ENDDO
  143.    SIMPLEBOX(.F.)
  144. ENDDO
  145. SIMPLEBOX(.F.)
  146. SET COLOR TO
  147. CLEAR
  148. QUIT
  149. RETURN(NIL)
  150. *---------------------------------------------------------------------------
  151. FUNCTION COLORSET(nPos)
  152. STATIC aColor := {"W/B,N/BG,N,N,GR+/B","W+/B","N/BG"}
  153. STATIC aMono  := {"W/N,N/W,N,N,W+/N","W+/N","N/W"}
  154. IF ISCOLOR()
  155.    RETURN(aColor[nPos])
  156. ENDIF
  157. RETURN(aMono[nPos])
  158. *---------------------------------------------------------------------------
  159. FUNCTION SIMPLEBOX(lOpen,nTop,nLeft,nBottom,nRight)
  160. STATIC aBox := {}
  161. IF lOpen
  162.    AADD(aBox,{nTop,nLeft,nBottom,nRight,SAVESCREEN(nTop,nLeft,nBottom,nRight)} )
  163.    @ nTop,nLeft,nBottom,nRight BOX  "┌─┐│┘─└│ "
  164. ELSE
  165.    RESTSCREEN(aBox[len(aBox)][1],aBox[len(aBox)][2],aBox[len(aBox)][3],;
  166.    aBox[len(aBox)][4],aBox[len(aBox)][5])
  167.    ASIZE(aBox,LEN(aBox)-1)
  168. ENDIF
  169. RETURN(NIL)
  170. *---------------------------------------------------------------------------
  171.